package sy.model.entity;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Transient;
import javax.persistence.Table;

import sy.util.StringUtil;

/**
 * ${tableComment}
 * <pre>
 * ${tableName}
 * ${className}
 * zhangxiaojin
 * </pre>
 */
@Entity
@Table(name = "${tableName}")
public class ${className} implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
<#list  columnList as columnEntity >
	/**${columnEntity.columnComment}*/
	private ${columnEntity.javaDataType} ${columnEntity.javaname};
	
</#list>


	public ${className} (){}



<#list  columnList as columnEntity >
	<#if columnEntity.pki==true >
	/**get ${columnEntity.columnComment}*/
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "${columnEntity.javaname}", unique = true, nullable = false)
	public ${columnEntity.javaDataType} get${columnEntity.javaName}() {
		return ${columnEntity.javaname};
	}
	/**set ${columnEntity.columnComment}*/
	public void set${columnEntity.javaName}(${columnEntity.javaDataType} ${columnEntity.javaname}) {
		this.${columnEntity.javaname} = ${columnEntity.javaname};
	}	
	<#else>
	/**get ${columnEntity.columnComment}*/
	@Column(name = "${columnEntity.javaname}")
	public ${columnEntity.javaDataType} get${columnEntity.javaName}() {
		<#if columnEntity.javaDataType=='String' >
		return  StringUtil.trim(${columnEntity.javaname});
		</#if>
		<#if columnEntity.javaDataType!='String' >
		return ${columnEntity.javaname};
		</#if>		
	}
	/**set ${columnEntity.columnComment}*/
	public void set${columnEntity.javaName}(${columnEntity.javaDataType} ${columnEntity.javaname}) {
		<#if columnEntity.javaDataType=='String' >
		this.${columnEntity.javaname} = StringUtil.trim(${columnEntity.javaname});
		</#if>
		<#if columnEntity.javaDataType!='String' >
		this.${columnEntity.javaname} = ${columnEntity.javaname};
		</#if>		
	}
	</#if>
	
</#list>

	public String toString() {
		return "${className}[<#list columnList as columnEntity><#if columnEntity_index!=0>",</#if> ${columnEntity.javaname}=" + ${columnEntity.javaname} + </#list>"]";
	}


}